<template>
  <div>
    <custom-table
      :columns="columns"
      :query="queryParams"
      :row-btn="rowBtn"
      v-bind="$attrs"
      v-on="listeners"
      @tap-head-btn="onTapHeadBtn"
      @tap-row-btn="onTapRowBtn"
      @row-dblclick="onRowDbClick"
    >
    </custom-table>
  </div>

</template>

<script>
import tableMixin from '@/utils/mixin/custom-table'
// import mock from '@/utils/mixin/mock'

// var Mock = require('mockjs')
// import { randomNum } from '@/utils'

export default {
  data() {
    return {
      columns: [
        { name: '名称', field: 'name' },
        { name: 'IMEI', field: 'IMEI' },
        { name: '巡检内容', field: 'pollingType.name', type: 'tag' },
        { name: '巡检频率', field: 'date_type', label: true, type: 'tag', format(col, row) {
          return row.date_type == 0 ? row.mode + '小时一次' : row.mode + '天一次'
        } },
        // { name: '状态', field: 'status', label: true, type: this.checkAuth('change') ? 'switch' : 'tag', opts: {} },
        // { name: '状态', field: 'status', type: 'tag', opts: {} },
        { name: '添加时间', field: 'create_time' }
      ]
    }
  },
  components: {},
  mixins: [
    tableMixin
    // mock
  ],
  computed: {
    rowBtn() {
      return []
    }
  },
  props: {},
  filters: {},
  created() {
  },
  methods: {
    /*
    onLoad() {
      Mock.Random.extend({
        status() {
          return this.pick(['禁用', '启用'])
        },
        deviceName() {
          return '巡检设备' + randomNum(1, 999)
        },
        check() {
          return this.pick(['空调', '电梯', '热水器', 'wifi', '充电桩', '快递柜'])
        },
        mode() {
          return randomNum(1, 10) + this.pick(['天', '小时']) + '一次'
        }
      })
      var data = Mock.mock({
        // 属性 list 的值是一个数组，其中含有 1 到 10 个元素
        'list|20': [{
          // 属性 id 是一个自增数，起始值为 1，每次增 1
          'id|+1': 1,
          'create_time': '@now',
          'imei': /\d{15}/,
          'status': '@status',
          'name': '@devicename',
          'check': '@check',
          'mode': '@mode'
        }]
      })

      console.log('mock', data)

      this.setMockData(data)
    }
    */
  }
}
</script>

<style lang="scss">

</style>
